﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;

namespace IBRx {
	public class ServerConnectionResponse : IBResponse { }

	public class ConnectionClosed : ServerConnectionResponse { }

	public class ServerConnectionRequest : IBRequests { }

	public class EConnect : ServerConnectionRequest {
		public String Host { get; private set; }
		public int Port { get; private set; }
		public int ClientId { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public EConnect(String host,  int port,  int clientId) {
			this.Host = host;
			this.Port = port;
			this.ClientId = clientId;
		}

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public EConnect(int port, int clientId) : this("localhost", port, clientId) { }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public EConnect() : this("localhost", 7496, 0) { }
	}

	public class EDisconnect : ServerConnectionRequest { }

	public class IsConnected : ServerConnectionRequest { }

	public class IsConnectedResponse : ServerConnectionResponse {
		public bool Result { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public IsConnectedResponse(bool result) {
			this.Result = result;
		}
	}

	public class SetServerLogLevel : ServerConnectionRequest {
		public LogLevels LogLevel { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public SetServerLogLevel(LogLevels logLevel) {
			this.LogLevel = logLevel;
		}
	}

	public class ReqCurrentTime : ServerConnectionRequest { }

	public class ServerVersion : ServerConnectionRequest { }

	public class ServerVersionResponse : ServerConnectionResponse {
		public int ServerLevel { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public ServerVersionResponse(int serverVersion) {
			this.ServerLevel = serverVersion;
		}
	}

	public class TwsConnectionTime : ServerConnectionRequest { }

	public class ReqGlobalCancel : ServerConnectionRequest { }
}
